vcpu_regs defined in ptrace.h (get regs from vcpu). Manual conversions and duplicate...
authordjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Wed, 23 Nov 2005 20:43:05 +0000 (14:43 -0600)
committerdjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Wed, 23 Nov 2005 20:43:05 +0000 (14:43 -0600)
xen/arch/ia64/xen/domain.c
xen/arch/ia64/xen/vcpu.c
xen/arch/ia64/xen/xenmisc.c
xen/include/asm-ia64/linux-xen/asm/ptrace.h
xen/include/asm-ia64/vmx_vcpu.h

index bca625d77b212f04a2e730bd618994bc5eb58b94..b6fc57a45042ed948c6b742b8d6121b877ac65b8 100644 (file)
@@ -165,7 +165,7 @@ void free_vcpu_struct(struct vcpu *v)
 
 static void init_switch_stack(struct vcpu *v)
 {
-       struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+       struct pt_regs *regs = vcpu_regs (v);
        struct switch_stack *sw = (struct switch_stack *) regs - 1;
        extern void ia64_ret_from_clone;
 
@@ -253,7 +253,7 @@ void arch_do_createdomain(struct vcpu *v)
 
 void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c)
 {
-       struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+       struct pt_regs *regs = vcpu_regs (v);
 
        printf("arch_getdomaininfo_ctxt\n");
        c->regs = *regs;
@@ -264,7 +264,7 @@ void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c)
 
 int arch_set_info_guest(struct vcpu *v, struct vcpu_guest_context *c)
 {
-       struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+       struct pt_regs *regs = vcpu_regs (v);
        struct domain *d = v->domain;
        int i, rc, ret;
        unsigned long progress = 0;
@@ -335,7 +335,7 @@ void new_thread(struct vcpu *v,
        if (d == dom0) start_pc += dom0_start;
 #endif
 
-       regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+       regs = vcpu_regs (v);
        if (VMX_DOMAIN(v)) {
                /* dt/rt/it:1;i/ic:1, si:1, vm/bn:1, ac:1 */
                regs->cr_ipsr = 0x501008826008; /* Need to be expanded as macro */
index 4aa50eea404e4caea2ef2bf6bde6dd21c40fa983..b73467d271cfae3d38610c10cc15187d060dffbe 100644 (file)
@@ -33,7 +33,6 @@ typedef       union {
 
 // this def for vcpu_regs won't work if kernel stack is present
 //#define      vcpu_regs(vcpu) ((struct pt_regs *) vcpu->arch.regs
-#define vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + IA64_STK_OFFSET)) - 1)
 #define        PSCB(x,y)       VCPU(x,y)
 #define        PSCBX(x,y)      x->arch.y
 
index aa8ca1124c5e475d34135391631ba63c596d02b8..76be33532e11bb59e4592aed3abff53724ba60a6 100644 (file)
@@ -72,7 +72,7 @@ int grant_table_create(struct domain *d) { return 0; }
 void grant_table_destroy(struct domain *d) { return; }
 #endif
 
-struct pt_regs *guest_cpu_user_regs(void) { return ia64_task_regs(current); }
+struct pt_regs *guest_cpu_user_regs(void) { return vcpu_regs(current); }
 
 void raise_actimer_softirq(void)
 {
index ef8bcaef797885fa1b44ea2780a9db2cdf6013e9..a07b305961f9ea16551cd87b56ce6f1fb4efb587 100644 (file)
 #ifdef XEN
 #include <public/arch-ia64.h>
 #define pt_regs cpu_user_regs
+
+/*  User regs at placed at the end of the vcpu area.
+    Convert a vcpu pointer to a regs pointer.
+    Note: this is the same as ia64_task_regs, but it uses a Xen-friendly name.
+*/
+struct vcpu;
+static inline struct cpu_user_regs *
+vcpu_regs (struct vcpu *v)
+{
+  return (struct cpu_user_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+}
+
+
 #else
 struct pt_regs {
        /* The following registers are saved by SAVE_MIN: */
index 2ac3532e38bc01c84d1aea5324b8deb620c4f8bc..4f9017552515003453dfe42c7748e8eaaca071cc 100644 (file)
@@ -44,8 +44,6 @@
 #define VRN7    0x7UL
 // for vlsapic
 #define  VLSAPIC_INSVC(vcpu, i) ((vcpu)->arch.insvc[i])
-// this def for vcpu_regs won't work if kernel stack is present
-#define        vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + IA64_STK_OFFSET)) - 1)
 //#define      VMX_VPD(x,y)    ((x)->arch.arch_vmx.vpd->y)
 
 #define VMX(x,y)  ((x)->arch.arch_vmx.y)